package teshop.dao;

import java.io.Serializable;
import java.util.List;

/**
 * Generic DAO contract interface
 * Created: 24.02.2009
 * @author Hryhory Lira
 *
 * @param <T>
 * @param <ID>
 */
public interface GenericDAO<T, ID extends Serializable> {
	  
	/**
	 * Gets object by its id
	 * @param id
	 * @return
	 */
	T loadById(ID id);
	
	/**
	 * Creates new object
	 * @param entity
	 */
	void persist(T entity);
	
	/**
	 * Updates object's attributes
	 * @param entity
	 */
	void update(T entity);
	
	/**
	 * Deletes object
	 * @param entity
	 */
	void delete(T entity);
	
	/**
	 * @return list of all objects of this type
	 */
	List<T> loadAll();

}
